package com.ruoyi.web.controller.systemIntegration;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.HcMainOrder;
import com.ruoyi.system.service.HcMainOrderDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 互创接口数据Controller
 *
 * @author ruoyi
 * @date 2023-07-27
 */
@RestController
@RequestMapping("/systemIntegration/hcOrder")
public class HcOrderDataController extends BaseController
{
    @Autowired
    private HcMainOrderDataService hcOrderDataService;

    /**
     * 查询患者信息列表
     */
    @PreAuthorize("@ss.hasPermi('systemIntegration:hcOrderData:list')")
    @GetMapping("/list")
    public TableDataInfo list(HcMainOrder hcMainOrder)
    {
        startPage();
        List<HcMainOrder> list = hcOrderDataService.selectHcMainOrderDataList(hcMainOrder);
        return getDataTable(list);
    }

    /**
     * 导出互创接口数据列表
     */
    @PreAuthorize("@ss.hasPermi('systemIntegration:hcOrderData:export')")
    @Log(title = "互创接口数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HcMainOrder hcMainOrder)
    {
        List<HcMainOrder> list = hcOrderDataService.selectHcMainOrderDataList(hcMainOrder);
        ExcelUtil<HcMainOrder> util = new ExcelUtil<>(HcMainOrder.class);
        util.exportExcel(response, list, "互创接口数据数据");
    }

    /**
     * 获取互创接口数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('systemIntegration:hcOrderData:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        Map hcMainOrder=hcOrderDataService.selectHcOrderInfo(Integer.valueOf(id));
        return AjaxResult.success(hcMainOrder);
    }
}
